import request from "@/utils/request";

// 创建订单(单游戏)
export const createOrderApi = (gameId: any) => {
  return request({
    url: "/order",
    method: "post",
    data: gameId,
  });
};

// 创建订单(购物车)
export const createOrderByCartApi = () => {
  return request({
    url: "/order/cart",
    method: "post",
  });
};

// 获取订单列表
export const getOrderListApi = (params: any) => {
  return request({
    url: "/order/list",
    method: "get",
    params,
  });
};

// 获取订单详情
export const getOrderDetailApi = (id: any) => {
  return request({
    url: `/order/${id}`,
    method: "get",
  });
};

// 支付订单
export const payOrderApi = (id: any) => {
  return request({
    url: `/order/${id}/pay`,
    method: "post",
  });
};

// 订单明细获取
export const getOrderItemApi = (orderId: any) => {
  return request({
    url: `/order_item`,
    method: "get",
    params: { orderId },
  });
};
